package com.gitee.xhs.savePointReader.windowState;

import cn.hutool.core.date.DateUtil;
import org.apache.flink.streaming.api.windowing.windows.TimeWindow;

import java.util.Date;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * @author BigHead
 * @date 2022/7/8 14:57
 * @description windowStateExhibitor
 */
public class WindowStateExhibitor {

    private String jobId;
    private String operatorUid;

    private long accountId;
    private Long startTime;
    private Long endTime;
    private Double sumAmount;

    private TimeWindow timeWindow;
    private Set<Long> triggerTimers;

    public String getJobId() {
        return jobId;
    }

    public void setJobId(String jobId) {
        this.jobId = jobId;
    }

    public String getOperatorUid() {
        return operatorUid;
    }

    public void setOperatorUid(String operatorUid) {
        this.operatorUid = operatorUid;
    }

    public long getAccountId() {
        return accountId;
    }

    public void setAccountId(long accountId) {
        this.accountId = accountId;
    }

    public Long getStartTime() {
        return startTime;
    }

    public void setStartTime(Long startTime) {
        this.startTime = startTime;
    }

    public Long getEndTime() {
        return endTime;
    }

    public void setEndTime(Long endTime) {
        this.endTime = endTime;
    }

    public Double getSumAmount() {
        return sumAmount;
    }

    public void setSumAmount(Double sumAmount) {
        this.sumAmount = sumAmount;
    }

    public TimeWindow getTimeWindow() {
        return timeWindow;
    }

    public void setTimeWindow(TimeWindow timeWindow) {
        this.timeWindow = timeWindow;
    }

    public Set<Long> getTriggerTimers() {
        return triggerTimers;
    }

    public void setTriggerTimers(Set<Long> triggerTimers) {
        this.triggerTimers = triggerTimers;
    }

    @Override
    public String toString() {
        return "WindowStateExhibitor{" +
                "jobId='" + jobId + '\'' +
                ", operatorUid='" + operatorUid + '\'' +
                ", accountId=" + accountId +
                ", startTime=" + startTime +
                ", startTimeString='" + DateUtil.formatDateTime(new Date(startTime)) + "'" +
                ", endTime=" + endTime +
                ", endTimeString='" + DateUtil.formatDateTime(new Date(endTime)) + "'" +
                ", sumAmount=" + sumAmount +
                ", timeWindow=" + timeWindow +
                ", triggerTimers=" + triggerTimers.stream().map(Object::toString).collect(Collectors.joining(",")) +
                '}';
    }
}
